//
//  MusicPlayerManager.m
//  kyMusicPlayer
//
//  Created by 翁科宇 on 2018/5/14.
//  Copyright © 2018年 翁科宇. All rights reserved.
//

#import "MusicPlayerManager.h"

@implementation MusicPlayerManager
static MusicPlayerManager *_sharedManager = nil;
+ (MusicPlayerManager *)sharedManager{
    @synchronized ([MusicPlayerManager class]){
        if (_sharedManager == nil) {
            _sharedManager = [[self alloc] init];
        }
    }
    //return nil;
    return _sharedManager;
}

- (void)setplayItem:(NSString *)songUrl{
    NSURL *url = [NSURL URLWithString:songUrl];
    _playItem = [[AVPlayerItem alloc] initWithURL:url];
}
- (void)setplay{
    _play = [[AVPlayer alloc] initWithPlayerItem:_playItem];
}

- (void)startplay{
    [_play play];
}

- (void)stopplay{
    [_play pause];
}


//- (void)play:(NSString *)songUrl{
//    [self setplayItem:songUrl];
//    [self setplay];
//    [self startplay];
//}
@end
